<div class="modal" id="editModal">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
				<h3 ng-hide='isNew'>Editar Funcion&aacute;rio: {{item.nome}}</h3>
				<h3 ng-show='isNew'>Incluir Funcion&aacute;rio</h3>
			</div>
			<form name="detailForm" ng-controller="DefaultFormCtrl" novalidate>
				<div class="modal-body">
					<ul id="tabs" class="nav nav-tabs" data-tabs="tabs">
					  	<li class="active"><a id="initTab" data-target="#pessoal" data-toggle="tab">Dados Pessoais</a></li>
					  	<li><a data-target="#endereco" data-toggle="tab">Endere&ccedil;o</a></li>
					 	<li><a data-target="#profissional" data-toggle="tab">Dados Profissionais</a></li>
					</ul>
					<div id="my-tab-content" class="tab-content">
						<div class="tab-pane active" id="pessoal">
							<div class='row'>
								<div class='col-sm-5'>
									<div class="form-group" ng-class="{ 'has-error' : detailForm.nome.$invalid && !detailForm.nome.$pristine }">
										<label for="nome">Nome</label>
										<input type="text" class="form-control" id="nome" name="nome" maxlength="50" placeholder="Nome" ng-model="item.nome" required/>
										<span class="help-block" ng-show="detailForm.nome.$invalid && !detailForm.nome.$pristine">Campo obrigat&oacute;rio!</span>
									</div>
								</div>
								<div class='col-sm-5'>
									<div class="form-group" ng-class="{ 'has-error' : detailForm.sobrenome.$invalid && !detailForm.sobrenome.$pristine }">
										<label for="sobrenome">Sobrenome</label>
										<input type="text" class="form-control" id="sobrenome" name="sobrenome" maxlength="100" placeholder="Sobrenome" ng-model="item.sobrenome" required/>
										<span class="help-block" ng-show="detailForm.sobrenome.$invalid && !detailForm.sobrenome.$pristine">Campo obrigat&oacute;rio!</span>
									</div>
								</div>
							</div>
							<div class='row'>
								<div class='col-sm-5'>
									<div class="form-group" ng-class="{ 'has-error' : detailForm.telefone.$invalid && !detailForm.telefone.$pristine }">
										<label for="telefone">Telefone</label>
										<input type="text" class="form-control telefone" id="telefone" name="telefone" maxlength="15" placeholder="Telefone" ng-model="item.telefone" required/>
										<span class="help-block" ng-show="detailForm.telefone.$invalid && !detailForm.telefone.$pristine">Campo obrigat&oacute;rio (somente n&uacute;meros)!</span>
									</div>
								</div>
								<div class='col-sm-5'>
									<div class="form-group" ng-class="{ 'has-error' : detailForm.dtNasc.$invalid && !detailForm.dtNasc.$pristine }">
										<label for="dtNasc">Data de Nascimento</label>
										<input type="date" class="form-control" id="dtNasc" name="dtNasc" placeholder="dd/mm/aaaa" ng-model="item.dataNasc" required/>
										<span class="help-block" ng-show="detailForm.dtNasc.$invalid && !detailForm.dtNasc.$pristine">Campo obrigat&oacute;rio!</span>
									</div>
								</div>
							</div>
							<div class='row'>
								<div class='col-sm-5'>
									<div class="form-group" ng-class="{ 'has-error' : detailForm.cpf.$invalid && !detailForm.cpf.$pristine }">
										<label for="cpf">CPF</label>
										<input type="text" class="form-control cpf" id="cpf" name="cpf" maxlength="11" placeholder="CPF" ng-model="item.cpf" required/>
										<span class="help-block" ng-show="detailForm.cpf.$invalid && !detailForm.cpf.$pristine">Campo obrigat&oacute;rio (somente n&uacute;meros)!</span>
									</div>
								</div>
								<div class='col-sm-5'>
									<div class="form-group" ng-class="{ 'has-error' : detailForm.rg.$invalid && !detailForm.rg.$pristine }">
										<label for="rg">RG</label>
										<input type="text" class="form-control rg" id="rg" name="rg" maxlength="10" placeholder="RG" ng-model="item.rg" required/>
										<span class="help-block" ng-show="detailForm.rg.$invalid && !detailForm.rg.$pristine">Campos obrigat&oacute;rios (somente n&uacute;meros)!</span>
									</div>
								</div>
							</div>
							<div class="checkbox">
								<label for="cbxAtivo"><input type="checkbox" id="cbxAtivo" ng-model="item.ativo" ng-true-value="S" ng-false-value="N"> Ativo</label>
							</div>
						</div>
						<div class="tab-pane" id="endereco">
							<div class='row'>
								<div class='col-sm-5'>
									<div class="form-group" ng-class="{ 'has-error' : detailForm.cep.$invalid && !detailForm.cep.$pristine }">
										<label for="cep">CEP</label>
										<input type="text" class="form-control cep" id="cep" name="cep" maxlength="10" placeholder="CEP" ng-model="item.enderecoEntidade.cep" ng-blur="findEndereco()" required/>
										<span class="help-block" ng-show="detailForm.cep.$invalid && !detailForm.cep.$pristine">Campos obrigat&oacute;rios!</span>
									</div>
								</div>
								<div class='col-sm-5'>
									<div class="form-group" ng-class="{ 'has-error' : detailForm.selEstado.$invalid && !detailForm.selEstado.$pristine }">
										<label for="selEstado">Estado</label>
										<select class="form-control" id="selEstado" name="selEstado" ng-model="item.enderecoEntidade.estado.id" ng-options="e.id as e.nome for e in estados" ng-change="updateCidades()" required>
									    	<option value="">Selecione</option>
									  	</select>
									  	<span class="help-block" ng-show="detailForm.selEstado.$invalid && !detailForm.selEstado.$pristine">Campo obrigat&oacute;rio!</span>
									</div>
								</div>
							</div>
							<div class='row'>
								<div class='col-sm-5'>
									<div class="form-group" ng-class="{ 'has-error' : detailForm.selCidade.$invalid && !detailForm.selCidade.$pristine }">
										<label for="selCidade">Cidade</label>
										<select class="form-control" id="selCidade" name="selCidade" ng-model="item.enderecoEntidade.cidade.id" ng-options="c.id as c.nome for c in cidades" required>
									    	<option value="">Selecione</option>
									  	</select>
									  	<span class="help-block" ng-show="detailForm.selCidade.$invalid && !detailForm.selCidade.$pristine">Campo obrigat&oacute;rio!</span>
									</div>
								</div>
								<div class='col-sm-5'>
									<div class="form-group" ng-class="{ 'has-error' : detailForm.bairro.$invalid && !detailForm.bairro.$pristine }">
										<label for="bairro">Bairro</label>
										<input type="text" class="form-control" id="bairro" name="bairro" maxlength="100" placeholder="Bairro" ng-model="item.enderecoEntidade.bairro" required/>
										<span class="help-block" ng-show="detailForm.bairro.$invalid && !detailForm.bairro.$pristine">Campos obrigat&oacute;rios!</span>
									</div>
								</div>
							</div>
							<div class='row'>
								<div class='col-sm-5'>
									<div class="form-group" ng-class="{ 'has-error' : detailForm.endereco.$invalid && !detailForm.endereco.$pristine }">
										<label for="endereco">Endere&ccedil;o</label>
										<input type="text" class="form-control" id="endereco" name="endereco" maxlength="200" placeholder="Endere&ccedil;o" ng-model="item.enderecoEntidade.endereco" required/>
										<span class="help-block" ng-show="detailForm.endereco.$invalid && !detailForm.endereco.$pristine">Campos obrigat&oacute;rios!</span>
									</div>
								</div>
								<div class='col-sm-5'>
									<div class="form-group">
										<label for="numero">N&uacute;mero</label>
										<input type="text" class="form-control" id="numero" name="numero" maxlength="6" placeholder="N&uacute;mero" ng-model="item.enderecoEntidade.numero"/>
									</div>
								</div>
							</div>
							<div class="form-group">
								<label for="complemento">Complemento</label>
								<input type="text" class="form-control" id="complemento" name="complemento" maxlength="100" placeholder="Complemento" ng-model="item.enderecoEntidade.complemento"/>
							</div>
						</div>
						<div class="tab-pane" id="profissional">
							<div class="form-group" ng-class="{ 'has-error' : detailForm.selLoja.$invalid && !detailForm.selLoja.$pristine }">
								<label for="selLoja">Loja</label>
								<select class="form-control" id="selLoja" name="selLoja" ng-model="item.loja.id" ng-options="l.id as l.nome for l in lojas" required>
							    	<option value="">Selecione</option>
							  	</select>
							  	<span class="help-block" ng-show="detailForm.selLoja.$invalid && !detailForm.selLoja.$pristine">Campo obrigat&oacute;rio!</span>
							</div>
							<div class='row'>
								<div class='col-sm-5'>
									<div class="form-group" ng-class="{ 'has-error' : detailForm.dtAdmissao.$invalid && !detailForm.dtAdmissao.$pristine }">
										<label for="dtAdmissao">Data de Admiss&atilde;o</label>
										<input type="date" class="form-control" id="dtAdmissao" name="dtAdmissao" placeholder="dd/mm/aaaa" ng-model="item.dataAdmissao" required/>
										<span class="help-block" ng-show="detailForm.dtAdmissao.$invalid && !detailForm.dtAdmissao.$pristine">Campo obrigat&oacute;rio!</span>
									</div>
								</div>
								<div class='col-sm-5'>
									<div class="form-group">
										<label for="dtDemissao">Data de Demiss&atilde;o</label>
										<input type="date" class="form-control" id="dtDemissao" name="dtDemissao" placeholder="dd/mm/aaaa" ng-model="item.dataDemissao">
									</div>
								</div>
							</div>
							<div class='row'>
								<div class='col-sm-5'>
									<div class="form-group" ng-class="{ 'has-error' : detailForm.cargo.$invalid && !detailForm.cargo.$pristine }">
										<label for="cargo">Cargo</label>
										<input type="text" class="form-control" id="cargo" name="cargo" maxlength="100" placeholder="Cargo" ng-model="item.cargo" required/>
										<span class="help-block" ng-show="detailForm.cargo.$invalid && !detailForm.cargo.$pristine">Campo obrigat&oacute;rio!</span>
									</div>
								</div>
								<div class='col-sm-5'>
									<div class="form-group" ng-class="{ 'has-error' : detailForm.salario.$invalid && !detailForm.salario.$pristine }">
										<label for="salario">Sal&aacute;rio (R$)</label>
										<input type="text" class="form-control moeda" id="salario" name="salario" maxlength="10" placeholder="Sal&aacute;rio (R$)" ng-model="item.salario" simon-decimal-format required/>
										<span class="help-block" ng-show="detailForm.salario.$invalid && !detailForm.salario.$pristine">Campo obrigat&oacute;rio!</span>
									</div>
								</div>
							</div>
							<div class='row'>
								<div class='col-sm-5'>
									<div class="form-group" ng-class="{ 'has-error' : detailForm.meta.$invalid && !detailForm.meta.$pristine }">
										<label for="meta">Meta (R$)</label>
										<input type="text" class="form-control moeda" id="meta" name="meta" maxlength="10" placeholder="Meta (R$)" ng-model="item.meta" simon-decimal-format required/>
										<span class="help-block" ng-show="detailForm.meta.$invalid && !detailForm.meta.$pristine">Campo obrigat&oacute;rio!</span>
									</div>
								</div>
								<div class='col-sm-5'>
									<div class="form-group" ng-class="{ 'has-error' : detailForm.comissao.$invalid && !detailForm.comissao.$pristine }">
										<label for="comissao">Comiss&atilde;o (%)</label>
										<input type="text" class="form-control percentual" id="comissao" name="comissao" maxlength="2" placeholder="Comiss&atilde;o (%)" ng-model="item.comissao" required/>
										<span class="help-block" ng-show="detailForm.comissao.$invalid && !detailForm.comissao.$pristine">Campo obrigat&oacute;rio!</span>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="modal-footer">
					<button class="btn btn-default" data-dismiss="modal" role="button">Fechar</button>
					<button ng-hide='isNew' class="btn btn-primary" id="btnAtualizar" data-dismiss="modal" ng-click="update()" role="button" ng-disabled="detailForm.$invalid">Atualizar</button>
					<button ng-show='isNew' class="btn btn-primary" id="btnIncluir" data-dismiss="modal" ng-click="insert()" role="button" ng-disabled="detailForm.$invalid">Incluir</button>
				</div>
			</form>
		</div>
	</div>
</div>